class bi1{
        public static void main(String[] args) {
                int[] intArray = {1,2,3,55,66,77,8,9,12};
	   int b[]=new int[50];
                int searchValue = 2, index;
                index = binarySearch(intArray, searchValue);
                if (index != -1) {
                        System.out.println("Found at index: " + index);
                } else {
                        System.out.println("Not Found");
                }
		bi1.fib(b);
 int i;
  int array[] = {12,9,4,99,120,1,3,10,13};
		
  System.out.println("Values Before the sort:\n");
  for(i = 0; i < array.length; i++)
  System.out.print( array[i]+"  ");
  System.out.println();
  quick_srt(array,0,array.length-1);
  System.out.print("Values after the sort:\n");
  for(i = 0; i <array.length; i++)
  System.out.print(array[i]+"  ");
  System.out.println();
	
        }

        static int binarySearch(int[] search, int find) {
                int start, end, midPt;
                start = 0;
                end = search.length - 1;
                while (start <= end) {
                        midPt = (start + end) / 2;
                        if (search[midPt] == find) {
                                return midPt;
                        } else if (search[midPt] < find) {
                                start = midPt + 1;
                        } else {
                                end = midPt - 1;
                        }
                }
                return -1;
        }
	public static void fib(int b[])
	{
		int n = 10,i;
		b[0]=0;
		b[1]=1;
                         	for(i=2; i < n; i++){
              		b[i] = b[i-1] + b[i-2];
                	}
		System.out.println("the fibonacci series is: " + "\t");
		for(i=0;i<n;i++)
		System.out.println(b[i] + "\t");
	}

 public static void quick_srt(int array[],int low, int n){
  int lo = low;
  int hi = n;
  if (lo >= n) {
  return;
  }
  int mid = array[(lo + hi) / 2];
  while (lo < hi) {
  while (lo<hi && array[lo] < mid) {
  lo++;
  }
  while (lo<hi && array[hi] > mid) {
  hi--;
  }
  if (lo < hi) {
  int T = array[lo];
  array[lo] = array[hi];
  array[hi] = T;
  }
  }
  if (hi < lo) {
  int T = hi;
  hi = lo;
  lo = T;
  }
  quick_srt(array, low, lo);
  quick_srt(array, lo == low ? lo+1 : lo, n);
  }
}
